<template>
	<view class="laywerInfo">
		<navbar></navbar>
		<textNavbar myprops="个人信息"></textNavbar>
		<view class="laywerInfo-content" v-for="item in list" :key="item.id">
			<van-cell title="执业信息" is-link><text style="font-size: 13px;" @click="message">执业证、律所、所在地区等</text> </van-cell>
			<view style="margin: 5px 0"><van-cell title="服务定价" value="自行设置服务价格" is-link @click="fwdj" /></view>
			<van-cell title="律师修改" value="修改信息" is-link @click="xiugai" />
			<van-cell title="姓名" :value="item.name" is-link />
			<van-cell title="头像" center is-link use-label-slot>
				<template #label>
					<view style="font-size: 10px;">(500px x 500px) x n</view>
					<view style="font-size: 10px;">客户端展示与分享使用, 请保持清晰</view>
				</template>
				<image style="width: 60px; height: 60px;" :src="item.image" mode=""></image>
			</van-cell>
			<van-cell title="ID" :value="item.uid" />
			<van-cell title="手机号" :value="item.phone"  is-link @click="shouji" />
			<van-cell title="基本信息" is-link @click="jieshao"><text style="font-size: 13px;">简介、专业领域、收费标准</text></van-cell>
			<van-cell title="注册时间" :value="zcsj" />
		</view>
	</view>
</template>

<script>
	import { getlawyerDetail } from '../../../utils/utils'
	import { timestampToDate } from '../../../services/tool'
	export default {
		data() {
			return {
				list: [], // 律师信息
				zcsj: '', // 注册时间
				id: '', // 律师id
			}
		},
		onLoad() {
			let that = this
			getlawyerDetail((e) => {
				console.log('律师信息', e);
				that.list.push(e.data.lawyer)
				const add_time = e.data.lawyer.add_time
				const formattedDate = timestampToDate(parseInt(add_time));
				that.zcsj = formattedDate
				this.id = e.data.lawyer.id
			})
		},
		methods: {
			// 跳转到修改执业信息页面
			message () {
				uni.navigateTo({
					url: "/pages/Attorney side/practiceMessage/practiceMessage"
				})
			},
			// 修改手机号页面
			shouji () {
				uni.navigateTo({
					url: "/pages/Attorney side/phoneNumber/phoneNumber"
				})
			},
			// 修改介绍页面
			jieshao () {
				uni.navigateTo({
					url: "/pages/Attorney side/aboutMe/aboutMe"
				})
			},
			// 律师修改
			xiugai () {
				uni.navigateTo({
					url: `/pages/Attorney side/attorneyCheck/attorneyCheck?name=律师修改`
				})
			},
			// 服务定价页面
			fwdj () {
				uni.navigateTo({
					url: `/pages/Attorney side/fwdjPage/fwdjPage?id=${this.id}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.laywerInfo {
		width: 100vw;
		height: 100vh;
		background-color: #EDEDED;
	}

</style>
